import axios from "axios";
import {recList,questionData,answerListData,contentData,mizoneData,reData,MiQuestionData,MiContentData,MiBuyShow,MiReData,ArticleDetail,contentCommentList,momentData,questionSearchData} from '../typings'
export async function getRecommendMData(n:number) {
  let { data } = await axios.get<{
    data:recList
  }>('https://apis.netstart.cn/xmsc/communicate/home_rec?size=10&after='+n);
  return data;
}
// 问题详情
export async function getQuestionDetail(id: number) {
  let { data } = await axios.get<questionData>('https://apis.netstart.cn/xmsc/communicate/question_detail?q_id='+id+'&product_id=0');
  
  return data;
}

// 问题评论
// https://apis.netstart.cn/xmsc/communicate/question_answer_list?q_id=33767394&top_answer_id&size=10&after&page=1&need_secondary=true&is_hot=false
export async function getQuestionAnswerList(id: number,a:number,hot:number) {
  let { data } = await axios.get<answerListData>('https://apis.netstart.cn/xmsc/communicate/question_answer_list?q_id='+id+'&top_answer_id&size=10&after'+a+'&page=1&need_secondary=true&is_hot='+hot);
  return data;
}
// 内容详情
// https://apis.netstart.cn/xmsc/communicate/content_detail?&content_id=1337128
export async function getContentDetail(id: number) {
  let { data } = await axios.get<contentData>('https://apis.netstart.cn/xmsc/communicate/content_detail?&content_id='+id);
  console.log("getContentDetail=>",data);
  return data;
}
// 买家秀
// https://apis.netstart.cn/xmsc/communicate/mizone_product_comment_detail?comment_id=210597765
export async function getBuyShowDetail(id: number) {
  let { data } = await axios.get<contentData>('https://apis.netstart.cn/xmsc/communicate/mizone_product_comment_detail?comment_id='+id);
  console.log("getContentDetail=>",data);
  return data;
}

// 文章评论  ==  内容评论
// https://apis.netstart.cn/xmsc/communicate/comment_display_list?content_id=1337128&is_feature=false&size=10&page=1&is_summary=false

// 内容评论
// https://apis.netstart.cn/xmsc/communicate/comment_display_list?content_id=1337128&is_feature=false&size=10&page=1&is_summary=false


export async function getContentCommentList(id: number,p:number) {
  let { data } = await axios.get<contentCommentList>('https://apis.netstart.cn/xmsc/communicate/comment_display_list?content_id='+id+'&is_feature=false&size=10&page='+p+'&is_summary=false');
  console.log("getContentDetail=>",data);
  return data;
}
// 买家秀评论
export async function getBuyShowCommentList(id: number,n:number) {
  let { data } = await axios.get<contentCommentList>('https://apis.netstart.cn/xmsc/communicate/mizone_comment_list?comment_type=product_comment&product_comment_id='+id+'&page_size=10&page_index='+n);
  console.log("getContentDetail=>",data);
  return data;
}
// https://apis.netstart.cn/xmsc/communicate/mizone_comment_list?comment_type=product_comment&product_comment_id=210597765&page_size=10&page_index=1

// 文章详情
// https://apis.netstart.cn/xmsc/communicate/article_detail?id=1224051

export async function getArticleDetail(id: number) {
  let { data } = await axios.get<ArticleDetail>('https://apis.netstart.cn/xmsc/communicate/article_detail?id='+id);
  console.log("getContentDetail=>",data);
  return data;
}
// 文章评论







// 测评详情
export async function getMomentDetail(id: number) {
  let { data } = await axios.get<momentData>('https://apis.netstart.cn/xmsc/moment/get_moment_by_idlist?moment_id_list='+id);
  console.log("getContentDetail=>",data);
  return data;
}
// 测评评论
// https://apis.netstart.cn/xmsc/communicate/mizone_comment_list?comment_type=moment&moment_id=21542&page_size=10&page_index=1
export async function getMomentCommentList(id: number) {
  let { data } = await axios.get<contentCommentList>('https://apis.netstart.cn/xmsc/communicate/mizone_comment_list?comment_type=moment&moment_id='+id+'&page_size=10&page_index=1');
  console.log("getContentDetail=>",data);
  return data;
}
// 米圈详情
// https://apis.netstart.cn/xmsc/communicate/mizone_home?product_id=14834
// 米圈详情
export async function getMizone(id: number) {
  let { data } = await axios.get<mizoneData>('https://apis.netstart.cn/xmsc/communicate/mizone_home?product_id='+id);
  console.log("getMizone=>",data);
  return data;
}
// 米圈推荐
// https://apis.netstart.cn/xmsc/communicate/mizone_rec?product_id=14834&after&size=10C

export async function getMizoneRec(id: number,num) {
 let { data } = await axios.get<MiReData>('https://apis.netstart.cn/xmsc/communicate/mizone_rec?product_id='+id+'&after='+num+'&size=10');
 console.log("getMizoneRec=>", data);
 console.log("发起请求")
 return data;
}
// 米圈问大家
// https://apis.netstart.cn/xmsc/communicate/question_list?product_id=14834&tag_id=充电&size=10&after&need_detail=false
export async function getMizoneQuestionList(id: number,t?:string) {
  let { data } = await axios.get<MiQuestionData>('https://apis.netstart.cn/xmsc/communicate/question_list?product_id='+id+'&size=10&tag_id='+t);
  // console.log("getMizoneQuestionList=>", data);
  return data;
}
// 米圈搜索
// https://apis.netstart.cn/xmsc/communicate/question_search?product_id=14834&query=充电
export async function getMizoneQuestionSearch(id:number,q: string) {
  let { data } = await axios.get<questionSearchData>('https://apis.netstart.cn/xmsc/communicate/question_search?product_id='+id+'&query='+q);
  console.log("getMizoneQuestionSearch=>",data);
  return data;
}
// 米圈测评
// https://apis.netstart.cn/xmsc/communicate/mizone_content_list?product_id=14834&size=10&tag_id=58527&tag_type=2&page=1
export async function getMizoneContentList(c:number,n:number) {
  let { data } = await axios.get<MiContentData>('https://apis.netstart.cn/xmsc/communicate/mizone_content_list?product_id='+c+'&size=10&tag_id=58527&tag_type=2&page='+n);
  console.log("getMizoneContentList=>",data);
  return data;
}


// 米圈买家秀
// https://apis.netstart.cn/xmsc/communicate/mizone_buyer_show_list?product_id=14834&size=10&tag_id=58527&tag_type=2&page=1
export async function getMizoneBuyerShowList(q: number,b?:string
  ) {
  let { data } = await axios.get<MiBuyShow>('https://apis.netstart.cn/xmsc/communicate/mizone_buyer_show_list?commodity_id='
+q+'&page_size=10&profile_id='+b+'&page_index=1');
  console.log("getMizoneBuyerShowList=>",data);
  return data;
}
// export async function getMizoneBuyerShowList(q: string) {
//   let { data } = await axios.get<MiBuyShow>('https://apis.netstart.cn/xmsc/communicate/mizone_buyer_show_list?product_id='+q+'&size=10');
//   console.log("getMizoneBuyerShowList=>",data);
//   return data;
// }


